<script>
import SignthequoteService from '@/api/domains/signthequote/service/SignthequoteService';
import { CommonBusinessForm } from 'jdf-common-biz';
import {
  principal,
  department,
  createTime,
  serialNumber,
  secret,
  urgencys,
  contract,
  contractPhone,
  empty,
  title,
  countersign,
  memo,
} from '../form-field-constants';

export default {
  extends: CommonBusinessForm,
  data() {
    return {
      // 后台服务
      service: new SignthequoteService(),
      formData: {},
      // 表单字段布局配置
      formConfigs: [
        [department, principal, createTime],
        [serialNumber, secret, urgencys],
        [contract, contractPhone, empty(8)],
        [title],
        [{
          formElCode: 'mainSendText',
          colSpan: 24,
          attrs: {
            maxlength: 200,
          }
        }],
        [countersign('gssycz')],
        [memo],
      ],
      // 因在综合业务部分发环节，不填编号可以送公司领导批示，所以编号不是必填
      validateDocNumberRequired: false,
    };
  },
  methods: {
    initBiz() {
      this.$emit('update:documentFormTitle', '签报');
    }
  },
  watch: {
    'formData.title': {
      handler(val) {
        this.$emit('update:processTitle', `[${this.formData.department}]${val || ''}`);
      }
    },
  },
};
</script>
